<template>
  <div class="scanner">
    <van-nav-bar title="B2C分货" left-text="返回" @click-left="onClickLeft"></van-nav-bar>
    <van-cell-group>
      <div v-for="(item, index) in list" :key="index">
        <van-cell
          :title="item.orderCode + ' - ' + item.barCode + ' - ' + item.carLineNo"
          :label="item.sku + ' - ' + item.skuDesc + ' - ' + item.pickedQty + ' - ' + item.sortQty + ' - ' + item.diffQty"
        />
      </div>
    </van-cell-group>
    <van-empty v-if="list == ''" description="查询不到数据" />
  </div>
</template>
<script>
import {lookAllOrDiffDataPda} from "@/api/sortScan/sortScan.js";
export default {
  name: "lookAll",
  mounted() {
    if (!this.$route.query.sortHeaderId || !this.$route.query.type) {
      return;
    }
    this.lookAllOrDiffDataPda();
  },
  data() {
    return {
      list: []
    };
  },
  methods: {
    lookAllOrDiffDataPda() {
      let params = {
        sortHeaderId: this.$route.query.sortHeaderId,
        type: this.$route.query.type
      };
      lookAllOrDiffDataPda(params).then(response => {
        if (response.data.status) {
          this.list = response.data.data.sortData;
        }
      });
    },
    onClickLeft() {
      this.$router.push({
        name: "sort",
        params: {
          pickCartonId: this.$route.query.pickCartonId,
          carlineNo: this.$route.query.carlineNo
        }
      });
    }
  }
};
</script>
